/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.infotypes;

/**
 * This is the super-class for all info-objects. Their general purpose is to 
 * provide the data for updating the world-model due to received messages 
 * from the server. These are received in string-format, whereas the parser 
 * creates machine-usable info-objects out of them.
 */
public abstract class Info {
	
	/**
	 * Message type for visual data (players only)
	 */
	public static final int TYPE_VISUAL = 1;

	/**
	 * Message type for sense-body-infos.
	 */
	public static final int TYPE_SENSE = 2;

	/**
	 * Type for acustical messages.
	 */
	public static final int TYPE_AURAL = 3;

	/**
	 * Message type for init infos.
	 */
	public static final int TYPE_INIT = 4;

	/**
	 * Message type for visual data (coach and trainer)
	 */
	public static final int TYPE_COACHVI = 5;

	/**
	 * Message type for player configuration.
	 */
	public static final int TYPE_PPARAM = 6;

	/**
	 * Message type for server configuration.
	 */
	public static final int TYPE_SPARAM = 7;

	/**
	 * Message type for heterogeneous player types.
	 */
	public static final int TYPE_PTYPE = 8;

	/**
	 * Message type for say-infos received from other players.
	 */
	public static final int TYPE_AURAL_PSI = 9;

	/**
	 * Message type for say-infos received from the coach
	 */
	public static final int TYPE_AURAL_CSI = 10;

	/**
	 * Message type for player-assignment of the own team to 
	 * heterogeneous player types.
	 */
	public static final int TYPE_PLAYERTYPE = 11;

	/**
	 * Message type for player-assignment of the opponents team to 
	 * heterogeneous player types.
	 */
	public static final int TYPE_OPLAYERTYPE = 12;

	/**
	 * The message type of this info-object
	 */
	protected int infoType = -1;

	/**
	 * The cycle, in which this object is received.
	 */
	protected int cycle = -1;

	/**
	 * The time (system-time in millis), when the message was received.
	 */
	private long arrivalTime = -1;

	/**
	 * Default constructor - note that all extending (and not abstract classes)
	 * should have an infoType, which is used to determine the info type (better
	 * performance than instanceof).
	 * 
	 * @param iCycle
	 *            cycle of the Info Object
	 */
	public Info(int iCycle) {
		this.cycle = iCycle;
	} // end of constructor Info(int iCycle)

	/**
	 * Returns the cycle of the Info Object
	 * 
	 * @return cycle of the Info Object
	 */
	public int getCycle() {
		return this.cycle;
	} // end of method getCycle()

	/**
	 * @return Returns the arrivalTime.
	 */
	public long getArrivalTime() {
		return this.arrivalTime;
	}

	/**
	 * @param arrivalTime
	 *            The arrivalTime to set.
	 */
	public void setArrivalTime(long arrivalTime) {
		this.arrivalTime = arrivalTime;
	}

	/**
	 * To set the cycle for an info
	 * 
	 * @param cycle
	 */
	public void setCycle(int cycle) {
		this.cycle = cycle;
	}

	/**
	 * Retrieve the type, which should be one of TYPE_VISUAL, TYPE_SENSE,
	 * TYPE_AURAL, TYPE_INIT, TYPE_COACHVI, ...
	 * 
	 * @return the info Type
	 */
	public int getInfoType() {
		return this.infoType;
	}

}
